<%@ page import="java.sql.*" %><%--
  Created by IntelliJ IDEA.
  User: Muerzhi
  Date: 2023/12/26
  Time: 8:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body background="picture/page.webp"
style="background-repeat:no-repeat;
background-attachment:fixed;
background-size:100% 100%; ">
<%
    String bookId=request.getParameter("bookId");
    String bookName=request.getParameter("bookName");
%>

<%
    Class.forName("com.mysql.cj.jdbc.Driver");
    String url="jdbc:mysql://localhost:3306/library";
    String username="root";
    String password="17876724541";
    Connection conn= DriverManager.getConnection(url,username,password);
    Statement stat=conn.createStatement();

    String sql="select bookContent from bookcontent where bookId=?";
    PreparedStatement ps =conn.prepareStatement(sql);
    ps.setString(1,bookId);
    ResultSet rs=ps.executeQuery();
    out.println("<h1>"+bookName+"</h1>");
    if(rs.next()){
        String content=rs.getString("bookContent");
        out.println("<p>"+content+"</p>");
    }
    stat.close();
    conn.close();
%>

</body>
</html>
